package com.arvin.mapper;

import com.arvin.pojo.Notice;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NoticeMapper {

    /**
     * 通过公告标题获取公告信息
     * @param noticeTitle
     * @return
     */
    List<Notice> getNoticeInfo(String noticeTitle,String noticeType,String noticeState);

    /**
     * 通过公告id获取公告信息
     * @param noticeId
     * @return
     */
    @Select("select * from t_notice where notice_id = #{noticeId} ")
    Notice getNoticeInfoById(Integer noticeId);

    /**
     * 发布公告
     * @param notice
     */
    void publishNotice(Notice notice);

    /**
     * 修改公告
     * @param notice
     */
    void updatePublishNotice(Notice notice);

    /**
     * 删除公告
     * @param noticeId
     */
    @Delete("delete from t_notice where notice_id = #{noticeId} ")
    void deleteNotice(Integer noticeId);

    /**
     * 查询全部公告信息
     * @return
     */
    List<Notice> selectAllNotice(String noticeState);
}
